package model;

import java.util.Collection;
import java.util.Vector;

public abstract class Observable {

	private final Collection<Observer> observers;
	
	public Observable(){
		this.observers = new Vector<Observer>();
		
	}
	
	public Collection<Observer> getObservers() {
		return observers;
	}



	public void register(final Observer o){
		this.observers.add(o);
	}
	
	public void deregister(final Observer o){
		if(this.observers.contains(o)){
			this.observers.remove(o);
		}
	}
	
	public void notifyObservers(){
		for(final Observer o : this.observers){
			o.stop();
		}
	}
}
